import request from "@/utils/request";

export default {
  // 获取列表
  getList(query, current = 1, size = 20) {
    return request({
      url: "/system/role/search",
      method: "POST",
      data: {
        ...query,
        current,
        size
      }
    });
  },
  // 删除
  delItem(id) {
    return request({
      url: `/system/role/${id}`,
      method: "DELETE"
    });
  },
  // 新增
  addItem(query) {
    return request({
      url: "/system/role",
      method: "POST",
      data: query
    });
  },
  // 查询单个
  findItem(id) {
    return request({
      url: `/system/role/${id}`,
      method: "GET"
    });
  },
  // 编辑
  editItem(query) {
    return request({
      url: "/system/role",
      method: "PUT",
      data: query
    });
  },
  // 获取分配权限列表
  getRightList() {
    return request({
      url: "/system/menu/search",
      method: "POST"
    });
  },
  // 获取已选择的权限id
  getRightIds() {
    return request({
      url: "/system/role/1/menu/ids",
      method: "GET"
    });
  },
  // 修改权限
  editRight(ids){
    return request({
      url: '/system/role/2/menu/save',
      method: 'POST',
      data: ids
    })
  }
};
